/**
 * @param {String} contentType
 */
export const getFileType = (contentType) => {
  if (contentType) {
    if (/^text\/[^/]+/.test(contentType) || (contentType === 'application/xml') || (contentType === 'application/xhtml+xml')) {
      return 'TEXT'
    } else if (/^image\/[^/]+/.test(contentType)) {
      return 'IMAGE'
    }
  }
  // Unknown
  return 'UNKNOWN'
}
